package com.ruoyi.project.emr.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.emr.mapper.EmrPatientMapper;
import com.ruoyi.project.emr.domain.EmrPatient;
import com.ruoyi.project.emr.service.IEmrPatientService;

/**
 * 患者Service业务层处理
 * 
 * @author gzu
 * @date 2023-07-21
 */
@Service
public class EmrPatientServiceImpl implements IEmrPatientService 
{
    @Autowired
    private EmrPatientMapper emrPatientMapper;

    /**
     * 查询患者
     * 
     * @param id 患者主键
     * @return 患者
     */
    @Override
    public EmrPatient selectEmrPatientById(Long id)
    {
        return emrPatientMapper.selectEmrPatientById(id);
    }

    /**
     * 查询患者列表
     * 
     * @param emrPatient 患者
     * @return 患者
     */
    @Override
    public List<EmrPatient> selectEmrPatientList(EmrPatient emrPatient)
    {
        return emrPatientMapper.selectEmrPatientList(emrPatient);
    }

    /**
     * 新增患者
     * 
     * @param emrPatient 患者
     * @return 结果
     */
    @Override
    public int insertEmrPatient(EmrPatient emrPatient)
    {
        emrPatient.setCreateTime(DateUtils.getNowDate());
        return emrPatientMapper.insertEmrPatient(emrPatient);
    }

    /**
     * 修改患者
     * 
     * @param emrPatient 患者
     * @return 结果
     */
    @Override
    public int updateEmrPatient(EmrPatient emrPatient)
    {
        emrPatient.setUpdateTime(DateUtils.getNowDate());
        return emrPatientMapper.updateEmrPatient(emrPatient);
    }

    /**
     * 批量删除患者
     * 
     * @param ids 需要删除的患者主键
     * @return 结果
     */
    @Override
    public int deleteEmrPatientByIds(Long[] ids)
    {
        return emrPatientMapper.deleteEmrPatientByIds(ids);
    }

    /**
     * 删除患者信息
     * 
     * @param id 患者主键
     * @return 结果
     */
    @Override
    public int deleteEmrPatientById(Long id)
    {
        return emrPatientMapper.deleteEmrPatientById(id);
    }
}
